package com.huahua.api.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @author LoveHuaHua
 * @date 2025年02月27日 13:31
 * @description believe in yourself
 */
@Getter
@RequiredArgsConstructor
public enum GithubAddressTypeEnum {

    NO_BRANCH_REPOSITORY("noBranchRepository", "没有分支的代码仓库"),

    HAS_BRANCH_REPOSITORY("hasBranchRepository", "有分支的代码仓库"),
    HAS_BRANCH_FILE("hasBranchFile", "有分支的代码文件"),

    RELEASES_URL("releasesUrl", "具体的一个发行文件地址"),
    /**
     * 链接错误
     */
    ERROR("error", "链接错误");


    private final String type;


    private final String typeName;


    public static GithubAddressTypeEnum toEnum(String type) {
        for (GithubAddressTypeEnum value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        return ERROR;
    }

}
